#include "VelocityMatch.h"

#include <iostream>

using namespace std;

VelocityMatch::VelocityMatch(){
  maxAcceleration = 0.005;
  timeToTarget = 0.1;
}

Steering* VelocityMatch::getSteering(){

  Steering* ret = new Steering();
  restarVectores(target->velocity, character->velocity, ret->linear);
  divVectorScalar(ret->linear,timeToTarget);
  if (length(ret->linear) > maxAcceleration){
    normalize(ret->linear);
    multVectorScalar(ret->linear,maxAcceleration);
  }
//    DEBUG
//    cout << " ret->ang" << ret->angular<< endl;
  return ret;
}